home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15585 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c,comp.unix.programmer
  4. Subject: Re: fgetc and getc (was Q: '\n' character)
  5. Date: Fri, 19 Apr 1996 13:38:44 GMT
  6. Organization: Netcom
  7. Message-ID: <3177965a.140894856@nntp.ix.netcom.com>
  8. References: <4kj66f$k0o@ren.cei.net> <4ku8f9$d3o@mark.ucdavis.edu> <4kumbqINNgcr@mayne.ugrad.cs.ubc.ca> <4l13uu$mva@mark.ucdavis.edu> <4l1ap4INNhsc@keats.ugrad.cs.ubc.ca> <Dq1s7F.Bo1@ukpsshp1.serigate.philips.nl>
  9. NNTP-Posting-Host: ix-dc14-19.ix.netcom.com
  10. X-NETCOM-Date: Fri Apr 19  6:38:50 AM PDT 1996
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes) wrote:
  14.  
  15. > Note however ANSI C does relax the rules slightly for getc and putc, if they
  16. > are implemented as a macro they can evaluate their argument more than once,
  17. > which fgetc and fputc cannot. 
  18.  
  19. A minor correction.  They may evaluate their FILE* argument more than
  20. once.  putc must evaluate its int argument exactly once.
  21.  
  22.     FILE** f;
  23.     int c;
  24.     ...
  25.     putc(c++, *f);        /* safe */
  26.     putc(c, *f++);        /* not safe */
  27.  
  28. Michael M Rubenstein
  29.